package com.amigo.online.provider.adv.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.amigo.online.common.param.result.adv.ProvinceAndCity;
import com.amigo.online.provider.adv.entity.AdvArea;

@Mapper
public interface AdvAreaMapper {

    @Select("select id from adv_area_tbl where ${language} = #{cityName} and used_type = 1")
    Integer getAreaByCityName(@Param("cityName") String city, @Param("language") String language);

    @Select("select * from adv_area_tbl where country_id = #{countryId}")
    List<AdvArea> getAreaList(@Param("countryId") Long countryId);

    @Select("select a.${column} as city,b.${column} as province from adv_area_tbl a join adv_area_tbl b on a.pid=b.id where a.id = #{areaId}")
    ProvinceAndCity getProvinceAndCityByCityId(@Param("areaId") Long cityId, @Param("column") String column);
}
